<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>大连飞北京机票分析</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel='stylesheet' href='/stylesheets/cover.css' />
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js" ></script>
    <!--<script type="text/javascript" src="/javascripts/vue.js"></script>-->
    <script type="text/javascript" src="/lib/vue.min.js"></script>
</head>
<body>

<div id="vue_block" class="site-wrapper">
    <!--<div class="site-wrapper">-->
        <div class="site-wrapper-inner">

        <div class="cover-container">

            <div class="masthead clearfix">
                <div class="inner">
                    <h3 class="masthead-brand">大连-北京机票分析</h3>
                    <nav>
                        <ul class="nav masthead-nav">
                            <li class="active"><a href="#" @click="home">主页</a></li>
                            <li><a href="#">关于</a></li>
                        </ul>
                    </nav>
                </div>
            </div>

            <div class="inner cover">
                <div v-if="pagename==='index'">
                    <button class="btn btn-default" @click="spidedata">爬取机票数据</button>
                    <button class="btn btn-default" style="margin-left: 10px">
                        分析机票数据
                    </button>
                    <div style="margin-top:20px;">
                        <textarea class="form-control" rows="20" readonly>
                            {{pagetext}}
                        </textarea>
                    </div>

                </div>
                <div v-else>
                    <p>正在制作</p>
                </div>
            </div>

            <div class="mastfoot">
                <div class="inner">
                    <p>大数据平台应用与开发大作业
                        <span style="display:block;width:50px;"></span>
                        陈宗豪  黄鑫
                    </p>
                </div>
            </div>

        </div>

    <!--</div>-->
    </div>
</div>
<script>
    new Vue({
        el: '#vue_block',
        data: {
            pagename:"index",
            pagetext:""
        },
        methods:{
            home:function(){
                this.pagename="index";
                alert("123");
            },
            spidedata:function(){
                spider();
            }
        }
    });
    var spider=function(){
        $.ajax({
            url:"/spide/spideflight",
            type:"get",
            contentType:"application/json;charset=utf-8",
            success:function(text){
                this.pagetext=text;
//                spider();
            }
        })
    }
</script>
</body>
</html>